﻿@{
    ViewData["Title"] = "日志 管理";
}
@section links{

    <link href="~/lib/myflow/common.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="~/lib/dataTables/datatables.min.css" type="text/css" />
    <link href="~/lib/myflow/index.css" type="text/css" rel="stylesheet" />
}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content text-center p-md ibox-content-search">
                    <form class="form-horizontal" datatable="tableGrid">
                        <div class="form-group col-md-4">
                            <label for="keyWord" class="col-md-3 control-label text-right">关键字</label>
                            <div class="col-md-9">
                                <input id="keyWord" name="keyWord" class="form-control" placeholder="关键字" />
                            </div>
                        </div>

                        <div>


                            <a class="btn btn-primary pull-right btn-rounded btn-search"><i class="fa fa-search"></i>搜  索</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content text-center p-md">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover dataTables" id="tableGrid">
                            <thead>
                                <tr>
                                    <td> 流程id</td>
                                    <td> 流程名称</td>
                                    <td> 状态</td>
                                    <td> 操作人</td>
                                    <td> 操作时间</td>
                                </tr>
                            </thead>
                            <tfoot>
                                <tr>
                                    <td> 流程id</td>
                                    <td> 流程名称</td>
                                    <td> 状态</td>
                                    <td> 操作人</td>
                                    <td> 操作时间</td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script type="text/javascript" src="~/lib/myflow/lib/raphael-min.js"></script>
    <!--这行不能注释-->
    <script type="text/javascript" src="~/lib_bower/jquery-ui/ui/jquery-ui.custom.js"></script>
    <script type="text/javascript" src="~/lib/myflow/myflow.js"></script>
    <script type="text/javascript" src="~/lib/myflow/myflow.jpdl4.js"></script>
    <script type="text/javascript" src="~/lib/myflow/myflow.editors.js"></script>
    <script type="text/javascript" src="~/lib/dataTables/datatables.min.js"></script>
    <script type="text/javascript" src="~/lib/myflow/workflow.js"></script>
    <script type="text/javascript">
        BaseUrl = "@Url.Content("~/WF")";
        $(document).ready(function () {

    var table = $(".dataTables").CustomForm({
    isValidate: false,
    isTable: true,
    "order": [[4, "desc"]], //默认排序
    deleteUrl:"@Url.Action("Delete")",
    ajaxUrl: "@Url.Action("ForGrid")",
    "columns": [

            {
                "name": "FlowId",
                "data":"FlowId",
                "title": " 流程id",
                "sDefaultContent": "",
                "type": 'string',
                "format":'',
                "bSortable": true,
                render: function (data, type, row)
                {
                    return row.FlowId + "<div style='display:none'>" + row.Chart + "</div>";
                }

            }
            ,{

                "name": "FlowName",
                "data":"FlowName",
                "title": " 流程名称",
                "sDefaultContent": "",
                "type": 'string',
                "format":'',
                "bSortable":true
            }
                   ,{
                        "name": "Status",
                        "data":"Status",
                        "title": " 状态",
                        "sDefaultContent": "",
                        "type": 'int',
                        "format":'',
                        "bSortable":true
                        ,render: function (data, type, row)
                        {
                            switch (row.Status)
                            {
                                case 0:
                                    return "迁出";
                                case 1:
                                    return "迁入";
                                case 2:
                                    return "撤销迁出";
                                case 10:
                                    return "发布";
                            }

                        }
                    }
                    ,{
                    "name": "ActionUserId",
                    "data":"ActionUserId",
                    "title": " 操作人",
                    "sDefaultContent": "",
                    "type": 'string',
                    "format":'',
                    "bSortable":true
                    },
                      {
                         "name": "LastModifyDate",
                         "data": "LastModifyDate",
                         "title": " 操作时间",
                         "sDefaultContent": "",
                         "type": 'string',
                         "format": '',
                         "bSortable": true
                     }
    ],
    "fnServerParams": function(data) {
    data.keyWord = $("#keyWord").val();//搜索参数
    }
    });

            $('.dataTables tbody').on('dblclick', 'tr', function () {
                var tr = $(this).closest('tr');
                var id = tr.find('td:first-child').find("input").val();//获取id
                var html = tr.find('td:eq(0)').children("div").html();

                if (html && html != null && html != "null" && html != undefined && html != "undefined") {

                    Notify.Remote({
                        Title: "流程图",
                        remote: "@Url.Action("LogFlow")",
                        loaded: function (modal, id) {//初始化对象

                            myWorkflow.workFlowId = "#myflow";
                            myWorkflow.workFlowContainerId = ".flow-container";
                            myWorkflow.InitFlow();
                            myWorkflow.loadWorkflow(eval("(" + html + ")"), true);
                            $("#myflow").children("svg").attr({ height: 400 });

                        }
                    });
                }

        });
    });


    </script>
}
